﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_sent : System.Web.UI.Page
{
    protected Administrator admin;
    int offset;
    protected void Page_Load(object sender, EventArgs e)
    {
        admin = Administrator.Check();
        if (admin == null)
        {
            Session.Add(Params.SystemError, "请先登录");
            Response.Redirect(Params.RootHttp + "default.aspx");
        }
        if (!Page.IsPostBack)
        {
            this.MyDataBind();
        }
    }

    public void MyDataBind()
    {
        this.conNav.Title = "发件箱";
        if (Request.Params["offset"] == null)
        {
            this.offset = 0;
        }
        else
        {
            this.offset = Convert.ToInt32(Request.Params["offset"]);
        }
        this.dgMessage.RecordCount = this.admin.SentNum;
        this.dgMessage.CurrentPageIndex = (this.offset / this.dgMessage.PageSize) + 1;
        this.repMessage.DataSource = this.admin.SentMes(this.offset, this.dgMessage.PageSize);
        this.repMessage.DataBind();
    }
    protected void dgMessage_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
    {
        Response.Redirect(Params.AdminFolderHttp + "sent.aspx?offset=" + Convert.ToString(this.dgMessage.PageSize * (e.NewPageIndex - 1)));
    }
}
